package com.oocl.myHomework.util;

import com.oocl.myHomework.entity.Person;


public class SortUtil {
     
      public static void  sortByName(Person[] array){
    	  for(int i=0 ; i<array.length-1;i++){
  			for(int j=0;j<array.length-1-i;j++){
  				if(array[j].getName().compareTo(array[j+1].getName())>0){
  					Person temp = array[j];
  					array[j] =array[j+1];
  					array[j+1]=temp;
  				}
  			}
  		}
     }
	public static void sortById(Person[] array) {
		// TODO Auto-generated method stub
		for(int i=0 ; i<array.length-1;i++){
  			for(int j=0;j<array.length-1-i;j++){
  				if(array[j].getId()>array[j+1].getId()){
  					Person temp = array[j];
  					array[j] =array[j+1];
  					array[j+1]=temp;
  				}
  			}
  		}
	}
}
